﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FCS;

namespace Applications.Test
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class GameTests : Functional
    {
        public GameTests()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        [TestMethod]
        public void QueensTest()
        {
            Assert.AreEqual(1, Length(new Queens(0)));
            Assert.IsTrue(IsEmpty<int>(At(0, new Queens(0))));

            Assert.AreEqual(1, Length(new Queens(1)));
            Assert.AreEqual(0, At(0, (At(0, new Queens(1)))));

            Assert.AreEqual(0, Length(new Queens(2)));
            Assert.AreEqual(0, Length(new Queens(3)));

            Assert.AreEqual(2, Length(new Queens(4)));
            Assert.IsTrue(Equals(ListFromArray(2, 0, 3, 1), At(0, new Queens(4))));
            Assert.IsTrue(Equals(ListFromArray(1, 3, 0, 2), At(1, new Queens(4))));

            Assert.AreEqual(92, Length(new Queens(8)));
            Assert.IsTrue(Equals(ListFromArray(3, 1, 6, 2, 5, 7, 4, 0), At(0, new Queens(8))));
            Assert.IsTrue(Equals(ListFromArray(4, 6, 1, 5, 2, 0, 3, 7), At(91, new Queens(8))));
        }
    }
}
